<!--
To change this template, choose Tools | Templates
and open the template in the editor.
-->
<!DOCTYPE html>
<html>
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
        <title></title>
    </head>
    <script type="text/javascript">
        $(".publicationItem").on("click", "input:checkbox", function()
        {
            var $this = $(this);
            var $total = $("#price");
            var $target = $("label[for='" + $this.attr("id") + "']");

            var item_value = +($target.html().replace("$", "") || 0);
            var cur_total = +($total.html().replace("$", "") || 0);

            if ($this.prop("checked") === true) {
                cur_total += item_value;
            } else {
                cur_total -= item_value;
            }

            $total.html("$" + cur_total);            
        }
    );
    </script>
    <body>
        <?php
            $month = array("January","February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December");
            $currentMonth = date("m");
           ?>
        <select>
            <?php
                for ($i = $currentMonth-1; $i >= 0; $i--)
                {
                    echo "<option>".$month[$i]."</option>";
                }
            ?>    
        </select>
        
        <form>
            <table border="1">
                <tr>
                    <td id="publicationItem">Paper 1</td>
                    <td id="price">30</td>
                    <td><input type="checkbox" onchange="UpdateTotal()"></td>
                </tr>
                <tr>
                    <td id="publicationItem">Paper 2</td>
                    <td id="price">50</td>
                    <td><input type="checkbox" onchange="UpdateTotal()"></td>
                </tr>
            </table>
        </form>
        <div id="price"></div>
    </body>
</html>
